#include "MergeSort.h"
#include<iostream>
#include<vector>
using namespace std;

int main()
{
	int num;
	vector<int> arr;
	while (cin >> num)
	{
		if (num == 12306)
		{
			//InsertionSort(arr);
			mergeSort(arr);
		}
		else if (num == 12312)
		{
			for (int i = 0; i < arr.size(); ++i)
			{
				cout << arr[i] << " ";
			}
		}
		else{
			arr.push_back(num);
		}


	}


}
